'use client'
import { createRoot } from 'react-dom/client'
import Show from './show'

export const closeFnSet = new Set<() => void>()
function Alert(props) {
  const container = document.createElement('div')
  document.body.appendChild(container)
  const root = createRoot(container)
  const close = () => {
    root.unmount()
    document.body.removeChild(container)
  }
  closeFnSet.add(close)
  root.render(<Show {...props} />)
}

export default Alert
